'use strict';

import AddressComponent from '../../prototype/addressComponent'

class Shop extends AddressComponent {
  constructor() {
    super()
  }
  // 获取餐馆列表
  async getRestaurants(ctx, next) {
    const {
      latitude,
      longitude,
      offset = 0,
      limit = 20,
      keyword,
      restaurant_category_id,
      order_by,
      extras,
      delivery_mode = [],
      support_ids = [],
      restaurant_category_ids = [],
    } = ctx.query;

    try {
      if (!latitude) {
        throw new Error('latitude参数错误')
      } else if (!longitude) {
        throw new Error('longitude参数错误');
      }
    } catch (err) {
      console.log('latitude,longitude参数错误');
      ctx.body = {
        status: 0,
        type: 'ERROR_PARAMS',
        message: err.message
      }
      return
    }

    ctx.body = {
      test: true
    }
  }
}

export default new Shop()